package learning.pcfg.training;

import learning.pcfg.inference.IndexedGrammar;
import learning.util.SparseVector;

public class PCFGParameters {
	
	// a feature weight vector for each production
	public SparseVector[] productionParameters;
	
	// the grammar
	public IndexedGrammar grammar;
	
	/*
	public void scale(float factor) {
		for (int i=0; i < productionParameters.length; i++)
			productionParameters[i].scale(factor);
	}*/
	
	public void sum(PCFGParameters p, float factor) {
		for (int i=0; i < productionParameters.length; i++)
			productionParameters[i] = SparseVector.sum(productionParameters[i], p.productionParameters[i], factor);
	}
	
	public void reset() {
		for (int i=0; i < productionParameters.length; i++)
			productionParameters[i].num = 0;
	}
}
